package com.zx._01_基础._011_集合;

import java.lang.reflect.Field;
import java.util.Hashtable;
import org.junit.Test;
import org.springframework.util.ReflectionUtils;

public class HashtableTest {

    @Test
    public void test01() throws IllegalAccessException {
        Hashtable<String, String> map = new Hashtable<>();
        Field findField = ReflectionUtils.findField(Hashtable.class, "table");
        findField.setAccessible(true);
        for (int i = 0; i < 100; i++) {
            map.put("" + i, "123");
            Object[] os = (Object[]) findField.get(map);
            System.out.println(map.size() + "~" + os.length);
        }
    }
}
